package com.edu.exam.enums.grading;

import com.edu.exam.enums.core.BaseEnum;

/**
 * 工作流优先级枚举
 *
 * @author 系统生成
 * @version 1.0
 * @since 2025-11-10
 */
public enum WorkflowPriority implements BaseEnum {

    /**
     * 低
     */
    LOW("LOW", "低"),

    /**
     * 普通
     */
    NORMAL("NORMAL", "普通"),

    /**
     * 高
     */
    HIGH("HIGH", "高"),

    /**
     * 紧急
     */
    URGENT("URGENT", "紧急");

    private final String code;
    private final String description;

    WorkflowPriority(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    /**
     * 从代码创建枚举实例
     *
     * @param code 枚举代码
     * @return 对应的枚举实例
     */
    public static WorkflowPriority fromCode(String code) {
        for (WorkflowPriority priority : values()) {
            if (priority.getCode().equals(code)) {
                return priority;
            }
        }
        throw new IllegalArgumentException("Unknown workflow priority code: " + code);
    }

    @Override
    public String toString() {
        return description;
    }
}